package edu.must.uh.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import edu.must.uh.bean.DeployQueryResultBean;
import edu.must.uh.util.PageHelper;
import edu.must.uh.util.SqlUtils;
import edu.must.uh.util.Tools;
import edu.must.uh.util.ToolsOfString;

public class RoleImpl extends BaseImpl {

    public RoleImpl() {
         super.cashkey     = "base_role";
         super.cashListkey = "base_role";
         super.keyFields   = "RoleId";
         super.tableName   = "base_role"; 
    }
    
    public List<Map<String, Object>> getRoleSelect() throws SQLException {
   	 
        String sqlString = "SELECT  RoleId ,Type ,FullName FROM base_role where DeleteMark = 0 order by  SortCode;" ; 
           
        List<Map<String,Object>>resList = SqlUtils.getMySqlInstance().getlist(sqlString);
        return resList; 
    }
    
    
    public  DeployQueryResultBean getLimitlist(Map<String, Object> searchcondition,
            String sqlcondition) throws Exception {        
           
            String sqlString = "SELECT SQL_CALC_FOUND_ROWS RoleId, Type,FullName,SortCode FROM base_role Where DeleteMark= 0  ";
            sqlString = sqlString + Tools.getSQLCondition(searchcondition);
            sqlString = sqlString +ToolsOfString.NulltoEmpty(sqlcondition) ;     
            sqlString = sqlString + PageHelper.getLimit(_PageBean);
            DeployQueryResultBean resList = SqlUtils.getMySqlInstance().getLimitlist(sqlString);
            return resList;
        }
    
}
